import request from "@/utils/request";

/**
 * 获取好友列表
 */
export function getFriendsApi() {
  return request({
    url: "/friend/list",
    method: "get",
  });
}

/**
 * 添加好友
 * @param {number} friendId 好友ID
 */
export function addFriendApi(friendId) {
  return request({
    url: "/friend/add",
    method: "post",
    params: { friendId },
  });
}

/**
 * 查找好友信息
 * @param {number} friendId 好友ID
 */
export function findFriendApi(friendId) {
  return request({
    url: `/friend/find/${friendId}`,
    method: "get",
  });
}

/**
 * 删除好友
 * @param {number} friendId 好友ID
 */
export function delFriendApi(friendId) {
  return request({
    url: `/friend/delete/${friendId}`,
    method: "delete",
  });
}

/**
 * 设置好友消息免打扰
 * @param {object} data
 * @param {number} data.friendId 好友ID
 * @param {boolean} data.isDnd 是否免打扰
 */
export function setFriendDndApi(data) {
  return request({
    url: "/friend/dnd",
    method: "put",
    data: data,
  });
}
